<template>
	<view class="privacy">
		<view style="margin:0 auto;border-top:3rpx solid red;width: 150rpx;height: 1rpx;background: #FF962D;">
	</view>
	
	<view style="margin-top:72rpx">
		<text>{{list.agreementTitle}}</text>
	</view>
	
	<view class="privacy-zt" style="margin:59rpx 34rpx 0 0;" v-if="isxians">
		<view>
			{{list.agreementContent}}
		</view>
	</view>
	
	<view @click="hidden" v-if="isShow" class="privacy-buttom d-flex a-center j-center position-absolute" style="left: 50%;top: 50%;transform: translate(-50%,100%);">
		我已知晓,并阅读所有协议（{{num}}）
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isShow:true,
				list:[],
				num:10,
				timeR:null,
				isxians:false
			}
		},
		onLoad() {
			this.getlist()
			this.countdown()
		},
		methods: {
			getlist(){
				this.$api.getUserAgreement({
					type:1
				},false).then(res=>{
					this.isxians = true
					this.list = res.data
				})
			},
			hidden(){
				this.isShow = false;
			},
			countdown(){
				this.timeR = null
				this.timeR = setInterval(()=>{
					this.num -=1
					this.timeTest()
				},1000)
			},
			timeTest(){
				if(this.num===0){
					clearInterval(this.timeR)
					this.hidden()
					return
				}
			}
		}
	}
</script>

<style lang="scss">
	.privacy{
		position: relative;
		margin-left:31rpx;
		text{
			font-size: 40rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #333333;
		}
		.privacy-zt{
			font-size: 26rpx;
			font-family: PingFang SC;
			font-weight: 300;
			color: #333333;
		}
		.privacy-buttom{
			width: 510rpx;
			height: 96rpx;
			background: #D7D7D7;
			border-radius: 14px;
			font-size: 26rpx;
			font-family: PingFang SC;
			font-weight: 300;
			color: #333333;
		}
	}
</style>
